After completing this lesson, you’ll be able to:
Using the FME Flow web interface, it's simple to select data from the resources folder at run-time. However, in some cases, the author will want to read data from a resources folder without the end-user having to select it.
To do this requires the use of an FME parameter to define the data as coming from the resources folders.
In FME Workbench, the Navigator window has a section called FME Flow Parameters, which is a list of FME Flow-specific parameters that can be integrated into workspace parameters. For a detailed description of all of the Flow Parameters, please see the FME Flow Parameters documentation.
The uses of these are many and varied; for example, FME_SECURITY_USER returns the name of the user running the workspace and could be used to either write to a custom log or perhaps filter data in different ways in the workspace based on the specific user. FME_JOB_ID would return the job ID number for running the workspace, often used to query for the job log file using the REST API.
However, when authoring workspaces to use data from the FME Flow Shared Resources Data folder, the most useful parameter is FME_SHAREDRESOURCE_DATA.
A common factor to all these parameters is that they only have an effect when the workspace is run on FME Flow. If the workspace is run on FME Form, it won't return a value. Therefore to test a workspace containing such a parameter on Form requires you to provide a dummy value.
The FME_SHAREDRESOURCE_DATA parameter returns the path of the shared resource data. When authoring a workspace to read data directly from the resource folder, you would normally create the workspace using a local copy of the data, and then update the source dataset field to include the FME Flow parameter:
Updating the field can be done directly by typing into the dialog, but is easier to achieve by clicking the drop-down arrow and choosing to use the Text Editor.
The entry in the Navigator window now looks like this:
Although the parameter is colored red in Form, when the workspace is run on Flow the parameter is replaced by the actual path and the data is read as expected.
It's important to remember (for example notice in the screenshots above) that the Flow parameter FME_SHAREDRESOURCE_DATA includes the 'Data' folder in its path.
For example, I use FME_SHAREDRESOURCE_DATA\Zoning\Zones.tab not FME_SHAREDRESOURCE_DATA\Data\Zoning\Zones.tab
Rather than setting the path in Workbench before uploading the data, you can also copy the path for an uploaded dataset and then paste that directly into Workbench.
The path for a shared resource is obtained by examining its properties in the FME Flow Resources pages. To do this, locate the resource, click the checkbox beside the file, then click the Actions drop-down menu and select Properties:
This path can then be copied and pasted into a workspace in order to reference that dataset directly without manually entering it. Of course, this does require that the data has already been uploaded to FME Flow, and isn't going to be uploaded with the workspace when it is published!